<link rel="stylesheet" href="__CSS__/mall.css"/>

<script src="__STATIC__/js/ace-extra.min.js"></script>
<script src="__STATIC__/js/laydate.js"></script>
<div class="page-header mbx">
    <h1>
        <small>
            {$companyName}分公司管理 ｜区县级分公司 <i class="ace-icon fa fa-times xx"></i>
        </small>
    </h1>
</div>
<div class="mbx" style="padding-bottom: 200px;">
    <div class="widget-box transparent">
        <div class="nav-tab" style="position: relative">
            <ul class="nav-tab-title ">
                <li class="nav-this">区县级分公司</li>
            </ul>
        </div>
        <div class="widget-body">
            <div class="widget-main padding-10">
                <div class="row">
                    <div class="col-xs-12">
                        <form class="form-horizontal s_input-bgcolor" method="post">
                            <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12 pad-b20">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label text-right no-padding-right" >公司名称： </label>
                                    <div class="col-sm-8" style="padding: 0;">
                                        <select name="sCityId" id="sCityId" class="form-control">
                                            <option>全部市级公司</option>
                                            {volist name="cityCompanyData" id="vo"}
                                            <option value="{$vo.CityId}" {if condition="$sCityId == $vo.CityId"}selected{/if}>{$vo.CompanyName}</option>
                                            {/volist}
                                        </select>
                                        <!--<input type="text" id="sCompanyName" name="sCompanyName" placeholder="请输入公司名称" value="{$sCompanyName}" class="form-control">-->
                                    </div>
                                </div>

                            </div>

                            <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12 pad-b20">
                                <div class="form-group">
                                    <div class="col-sm-8">
                                        <select name="sCountyId" id="sCountyId" class="form-control">
                                            <option>全部区县级公司</option>
                                            {volist name="countyCompanyData" id="vo"}
                                            <option value="{$vo.CountyId}" {if condition="$sCountyId == $vo.CountyId"}selected{/if}>{$vo.CompanyName}</option>
                                            {/volist}
                                        </select>
                                    </div>
                                </div>
                            </div>


                            <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12 pad-b20">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label text-right no-padding-right" for="sTrueName">公司法人： </label>
                                    <div class="col-sm-8">
                                        <input type="text" id="sTrueName" name="sTrueName" placeholder="请输入法人名称" value="{$sTrueName}"  class="form-control" >
                                    </div>
                                </div>
                            </div>


                            <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12 pad-b20">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label text-right no-padding-right" for="sAddress">公司地址： </label>
                                    <div class="col-sm-8">
                                        <input type="text" id="sAddress" name="sAddress" placeholder="请输入公司地址" value="{$sAddress}" class="form-control">
                                    </div>
                                </div>
                            </div>

                            <div class="col-lg-3 col-md-6 col-sm-12 col-xs-12 pad-b20">
                                <div class="form-group">
                                    <label class="col-sm-3 control-label text-right no-padding-right" for="start">成立时间： </label>
                                    <div class="col-sm-8">
                                        <div class="input-daterange input-group">
                                            <input type="text" class="input-sm form-control hm-shop-upgrade" placeholder="开始时间" value="{$start}" name="start" id="start"  style="">
                                            <span class="input-group-addon" style="background: none;border: none;">
																	-
																</span>
                                            <input type="text" class="input-sm form-control hm-shop-upgrade" placeholder="结束时间" value="{$end}" name="end" id="end" >
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="text-right">
                                <button class="btn " style="width: 120px;    border-radius: 2rem; background: #fba40a!important;border-color: #fba40a;margin-left: 20px;">查询</button>
                            </div>
                        </form>
                        <div class="space"></div>
                        <div class="row">
                            <div class="col-xs-12">
                                <table id="sample-table-1" class="table table-hover" width="100%" style="table-layout:fixed">
                                    <thead>
                                    <tr>
                                        <th class="left">公司名称</th>
                                        <th class="left">公司法人</th>
                                        <th class="left">公司地址</th>
                                        <th class="left">总收益</th>
                                        <th class="left">剩余资金</th>
                                        <th class="left">成立时间</th>
                                        <th class="center">操作</th>
                                    </tr>
                                    </thead>
                                    <tbody>

                                    {empty name="data"}
                                    <tr class="s_tr-vertical s_tr-border s_shoplist-first">
                                        <td colspan="7" class="center" style="color: red;">没有查询到结果</td>
                                    </tr>
                                    {/empty}

                                    {volist name="data" id="vo"}
                                    <tr class="s_tr-vertical s_tr-border s_shoplist-first">
                                        <td>
                                            {$vo.CompanyName}
                                        </td>
                                        <td>
                                            {$vo.TrueName}
                                        </td>
                                        <td class="left">
                                            {$vo.address}
                                        </td>
                                        <td class="left s_order-fun"  onclick="showIncomeDetail('{$vo.Id}');" style="cursor: pointer;">{$vo.Money}</td>
                                        <td class="left" >{$vo.LeftMoney}</td>
                                        <td class="left">{$vo.CreateOn}</td>
                                        <td class="center s_order-fun border-right" style="cursor: pointer"><a href="{:url('townscompany/index',['county_id'=>$vo.CountyId])}">查看惠民店</a></td>
                                    </tr>
                                    {/volist}
                                    </tbody>
                                </table>
                            </div>
                            <!-- /.span -->
                        </div>
                        <!-- /.row -->


                    </div>
                    <!-- /.col -->
                </div>
            </div>
        </div>
    </div>
    <div class="text-center">
        {$page}
    </div>

</div>

<div id="income" style="width: 100%;height: 100%;position: fixed;left: 0;top: 0;z-index: 9000000;display: none">
</div>

<script type="text/javascript">
    laydate.render({
        elem: '#start' //指定元素
    });
    laydate.render({
        elem: '#end' //指定元素
    });

    // 查看总收益详情
    function showIncomeDetail(cpid) {
        var html = '<span style="width: 100%;height: 100%;position: absolute;left: 0;top: 0;background: rgba(0,0,0,0.4)"></span><iframe src="/admin/income/companyIncomeDetail?cpid='+cpid+'"frameborder="0" style="width:1000px;height:700px;position: absolute;left: 50%;top: 50%;margin-left:-451px;margin-top:-336px;background: #fff;z-index: 1;"></iframe>';
        $('#income').html(html);
        $('#income').show();
    }

    function closeDialog() {
        $('#income').hide();
    }

    $("#sCityId").change(function () {
        // 获取cityId下的区县公司
        var cityId = $(this).val();
        $.ajax({
            url:"{:url('countycompany/ajaxGetCountyCompany')}",
            type:"post",
            dataType:"json",
            data:{
                cityId:cityId
            },
            success:function(response){
                var html = "<option>全部区县级公司</option>";
                if (response.code == '1' && response.data.length > 0) {
                    for (var i=0;i<response.data.length;i++)
                    {
                        html += "<option value='"+response.data[i].CountyId+"'>"+response.data[i].CompanyName+"</option>";
                    }

                }

                $("#sCountyId").html(html);
            },
            error:function() {
//                alert(JSON.stringify('出错了'));
            }
        });
    });
</script>